package com.ljc.controller;

import com.ljc.auth.UserAuthorities;
import com.ljc.entity.BaseResponse;
import com.ljc.service.UserAuthService;
import com.ljc.support.UserSupport;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserAuthController {
    @Resource
    private UserSupport userSupport;
    @Resource
    private UserAuthService userAuthService;

    /**
     * 获取用户权限
     */
    @GetMapping("/user-authorities")
    public BaseResponse<UserAuthorities> getUserAuthorities() {
        Long userId = userSupport.getCurrentUserId();
        UserAuthorities userAuthorities = userAuthService.getUserAuthorities(userId);
        return new BaseResponse<>(userAuthorities);
    }
}
